﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace lcs.Web.Outstorage
{
    public partial class PrintOutStorageList : System.Web.UI.Page
    {
        private decimal totalAllPrice = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["li_outList"] != null && Session["login"] != null)
                {
                    DataSet ds = Session["login"] as DataSet;

                    string username = ds.Tables[0].Rows[0]["user_name"].ToString();

                    List<lcs.Model.out_storageList> ol = Session["li_outList"] as List<lcs.Model.out_storageList>;

                    Bind(ol,username);
                }
            }
        }

        private void Bind(List<lcs.Model.out_storageList> ol,string username)
        {

            if (ol.Count > 0)
            {
                lcs.Model.out_storageList o = ol[0];
                //this.lbl_batchId.Text = out_storagelist_batchid;
                this.lbl_proid.Text = o.proid;
                this.lbl_project_name.Text = o.projectname;
                this.lbl_receive_address.Text = o.receive_address;
                this.lbl_receive_userName.Text = o.receive_userName;
                this.lbl_receive_userPhone.Text = o.receive_userPhone;
                this.lbl_username.Text = username;
                this.lbl_date.Text = System.DateTime.Now.ToShortDateString();

                this.GridView1.DataSource = ol;
                this.GridView1.DataBind();
            }

          

        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //if (e.Row.RowType == DataControlRowType.DataRow)
            //{
            //    Label lbl_unprice = e.Row.FindControl("lbl_unprice") as Label;//单价
            //    Label lbl_totalPrice = e.Row.FindControl("lbl_totalPrice") as Label;//金额
            //    Label lbl_nums = e.Row.FindControl("lbl_nums") as Label;//数量

            //    decimal unprice = decimal.Parse(lbl_unprice.Text);

            //    lbl_unprice.Text = unprice.ToString("0.00");

            //    decimal nums = decimal.Parse(lbl_nums.Text);

            //    lbl_totalPrice.Text = (unprice * nums).ToString("0.00");

            //    totalAllPrice += unprice * nums;
            //}
            //if (e.Row.RowType == DataControlRowType.Footer)
            //{
            //    Label lbl_totalAllPrice = e.Row.FindControl("lbl_totalAllPrice") as Label;//总计金额

            //    lbl_totalAllPrice.Text = "总计：" + totalAllPrice.ToString("0.00");
            //}
        }
        
    }
}